home *** CD-ROM | disk | FTP | other *** search
/ Teach Your Children: Road Construction Ahead / Teach Your Children: Road Construction Ahead.iso / pc / rca / road.dxr / 00024_Rotator Class.ls < prev    next >
Encoding:
Text File  |  1996-07-17  |  1.8 KB  |  90 lines

  1. property Xpos, xSteps, Ypos, ySteps, channel, multiplier, rotatorMovie
  2. global gCustomCursor, gRollAnimButton, g3DObject
  3.  
  4. on birth me
  5.   set channel to 2
  6.   set Xpos to 0
  7.   set xSteps to 23
  8.   set Ypos to 0
  9.   set ySteps to 13
  10.   set multiplier to 2
  11.   return me
  12. end
  13.  
  14. on setup me
  15.   puppetSprite(channel, 1)
  16.   set the castNum of sprite channel to the number of cast rotatorMovie
  17.   set the locH of sprite channel to 331
  18.   set Xpos to 0
  19.   set Ypos to 10
  20.   paletteFix()
  21.   set the visible of sprite channel to 0
  22.   go(the frame + 1)
  23.   set the movieTime of sprite channel to 230
  24.   set the visible of sprite channel to 1
  25. end
  26.  
  27. on arrowButton me
  28.   if not objectp(gRollAnimButton) then
  29.     if objectp(gCustomCursor) then
  30.       resetTool(g3DObject)
  31.       exit
  32.     else
  33.       set handlerName to the name of cast the castNum of sprite the clickOn
  34.       if char length(handlerName) of handlerName <> "+" then
  35.         set commandString to handlerName & "( gRotatorObject )"
  36.         birth(script "Repeating Button Class", commandString, 6)
  37.       end if
  38.     end if
  39.   end if
  40. end
  41.  
  42. on left me
  43.   set Xpos to Xpos - multiplier
  44.   if Xpos < 0 then
  45.     set Xpos to (xSteps * multiplier) - multiplier
  46.   end if
  47.   changeView(me)
  48.   return 1
  49. end
  50.  
  51. on right me
  52.   set Xpos to Xpos + multiplier
  53.   if Xpos = (xSteps * multiplier) then
  54.     set Xpos to 0
  55.   end if
  56.   changeView(me)
  57.   return 1
  58. end
  59.  
  60. on down me
  61.   if Ypos > 0 then
  62.     set Ypos to Ypos - multiplier
  63.     changeView(me)
  64.     return 1
  65.   else
  66.     return 0
  67.   end if
  68. end
  69.  
  70. on Up me
  71.   if Ypos < ((ySteps * multiplier) - multiplier) then
  72.     set Ypos to Ypos + multiplier
  73.     changeView(me)
  74.     return 1
  75.   else
  76.     return 0
  77.   end if
  78. end
  79.  
  80. on changeView me
  81.   set offset to Xpos + (Ypos * xSteps)
  82.   set the movieTime of sprite channel to offset
  83. end
  84.  
  85. on prepareToLeave me
  86.   set Xpos to 0
  87.   set Ypos to 0
  88.   puppetSprite(channel, 0)
  89. end
  90.